

import React from 'react';
import { MDXProvider } from '@mdx-js/react';
import { Link } from 'next/link';
import localFont from "next/font/local";
import "@/app/globals.css";
import "@/app/pm.css";
import CommonNavBar from '@/app/components/CommonNavbar';
import { Alert } from 'flowbite-react';
import BlogForceGraph from './BlogForceGraph';


// 自定义组件，用于覆盖 MDX 中的默认元素
const components = {
    a: ({ href, children, ...props }) => (
        href.startsWith('/') ? (
            <Link href={href}>
                <a {...props}>{children}</a>
            </Link>
        ) : (
            <a href={href} {...props}>
                {children}
            </a>
        )
    )
};

const MDXLayout = ({ children }) => {
    return (<>

        <CommonNavBar></CommonNavBar>
        <Alert color="warning" rounded>
            <span className="font-medium">尼采</span>  每一个不曾起舞的日子，都是对生命的辜负。
        </Alert>
        <MDXProvider components={components}>
            <div className="mdx-content">
                {children}
            </div>
            {/* <h1>相关文章</h1> */}
            {/* <BlogForceGraph /> */}
        </MDXProvider>

    </>
    );
};

export default MDXLayout;